CKEDITOR.dialog.add("radio",(function(e){return{title:e.lang.forms.checkboxAndRadio.radioTitle,minWidth:350,minHeight:140,getModel:function(e){return(e=e.getSelection().getSelectedElement())&&"input"==e.getName()&&"radio"==e.getAttribute("type")?e:null},onShow:function(){var e=this.getModel(this.getParentEditor());e&&this.setupContent(e)},onOk:function(){var e=this.getParentEditor(),t=this.getModel(e);t||((t=e.document.createElement("input")).setAttribute("type","radio"),e.insertElement(t)),this.commitContent({element:t})},contents:[{id:"info",label:e.lang.forms.checkboxAndRadio.radioTitle,title:e.lang.forms.checkboxAndRadio.radioTitle,elements:[{id:"name",type:"text",label:e.lang.common.name,default:"",accessKey:"N",setup:function(e){this.setValue(e.data("cke-saved-name")||e.getAttribute("name")||"")},commit:function(e){e=e.element,this.getValue()?e.data("cke-saved-name",this.getValue()):(e.data("cke-saved-name",!1),e.removeAttribute("name"))}},{id:"value",type:"text",label:e.lang.forms.checkboxAndRadio.value,default:"",accessKey:"V",setup:function(e){this.setValue(e.getAttribute("value")||"")},commit:function(e){e=e.element,this.getValue()?e.setAttribute("value",this.getValue()):e.removeAttribute("value")}},{id:"checked",type:"checkbox",label:e.lang.forms.checkboxAndRadio.selected,default:"",accessKey:"S",value:"checked",setup:function(e){this.setValue(e.getAttribute("checked"))},commit:function(t){var i=t.element;if(CKEDITOR.env.ie){var n=i.getAttribute("checked"),c=!!this.getValue();n!=c&&(n=CKEDITOR.dom.element.createFromHtml('<input type="radio"'+(c?' checked="checked"':"")+"></input>",e.document),i.copyAttributes(n,{type:1,checked:1}),n.replace(i),c&&n.setAttribute("checked","checked"),e.getSelection().selectElement(n),t.element=n)}else t=this.getValue(),CKEDITOR.env.webkit&&(i.$.checked=t),t?i.setAttribute("checked","checked"):i.removeAttribute("checked")}},{id:"required",type:"checkbox",label:e.lang.forms.checkboxAndRadio.required,default:"",accessKey:"Q",value:"required",setup:CKEDITOR.plugins.forms._setupRequiredAttribute,commit:function(e){e=e.element,this.getValue()?e.setAttribute("required","required"):e.removeAttribute("required")}}]}]}}));